package tianhaodata.integration.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import tianhaodata.integration.api.repository.entity.MembersEntity;
import tianhaodata.integration.api.service.MembersService;

import java.util.List;

@Controller
public class MembersController {
    @Autowired
    public MembersService membersService;

    @RequestMapping("/")
    private String index(Model model) {
        List<MembersEntity> entities = membersService.searchMembersList();
        model.addAttribute("page", entities);
        System.out.println(model.toString() + "model 吐出来的数据");
        return "index";
    }

    @RequestMapping("/searchList")
    @ResponseBody
    public List<MembersEntity> searchMembersList() {
        return membersService.searchMembersList();
    }
}
